#拷贝到/root/下执行
#wget https://github.com/fatedier/frp/releases/download/v0.33.0/frp_0.33.0_linux_arm.tar.gz
#wget https://gitee.com/zyq201/debian/raw/master/frp_0.33.0_linux_amd64.tar.gz
#wget https://github.com/fatedier/frp/releases/download/v0.36.2/frp_0.36.2_linux_amd64.tar.gz
apt-get install git  -y

rm -rf /root/frpc/
rm -rf /root/frp
rm -rf /root/
git clone https://gitee.com/zyq201/frp.git

cd /root/frp

tar -zxvf frp_0.36.2_linux_amd64.tar.gz

mv /root/frp/frp_0.36.2_linux_amd64  /root/frpc

cd /root
rm -rf /root/frpc/frpc.ini

#创建配置文件
mypath="/root/frpc/frpc.ini"
#创建服务器基本配置
	 echo "[common]" >> $mypath
	 echo "server_addr = frp.442230.xyz" >> $mypath
	 echo "server_port = 5443" >> $mypath
	 echo "token = J3VihyEHK6HsDQXW" >> $mypath
	 echo "login_fail_exit = false" >> $mypath
	 echo "log_max_days = 7" >> $mypath
	 
	#创建映射 
	 echo "[R930_debianSSH]" >> $mypath
	 echo "type = tcp" >> $mypath
	 echo "server_port = 5443" >> $mypath
	 echo "local_ip = 127.0.0.1" >> $mypath
	 echo "local_port = 22" >> $mypath
	 echo "remote_port = 2323" >> $mypath
	 
#安装守护进程
apt-get install supervisor -y
	mypath="/etc/supervisor/supervisord.conf"
	 echo "[program:frpc]" >> $mypath
	 echo "command=/root/frpc/frpc  -c /root/frpc/frpc.ini" >> $mypath
	 echo "autostart=true" >> $mypath
	 echo "autorestart=true" >> $mypath
	 echo "user=root" >> $mypath
	 #是否将程序错误信息重定向的到文件
	 echo "redirect_stderr=true" >> $mypath
	 #将程序输出重定向到该文件
	 echo "stdout_logfile=/root/frpc/frpc.log" >> $mypath
	 #将程序错误信息重定向到该文件
	 echo "stderr_logfile=/root/frpc/frpc-err.log" >> $mypath
supervisorctl reload 
supervisorctl status
